home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / FWArchiv / Include / FWArStat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-21  |  2.5 KB  |  75 lines  |  [TEXT/MPS ]

  1. #ifndef FWARSTAT_H
  2. #define FWARSTAT_H
  3. //========================================================================================
  4. //
  5. //    File:                FWArStat.h
  6. //    Release Version:    $ 1.0d1 $
  7. //
  8. //    Creation Date:        3/28/94
  9. //
  10. //    Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  11. //
  12. //========================================================================================
  13.  
  14. #ifndef FWARDYNA_H
  15. #include "FWArDyna.h"
  16. #endif
  17.  
  18.  
  19. //========================================================================================
  20. // CLASS FW_TStaticArchiver
  21. //========================================================================================
  22.  
  23. template <class tType>
  24. class FW_TStaticArchiver
  25. {
  26.  
  27. public:
  28.  
  29.     // ----- Call these methods to archive objects by reference.
  30.  
  31.     static tType* ReadStaticObject(FW_CReadableArchive& readableArchive);
  32.         // Constructs an object of type tType.
  33.         // The archive's object registry is used.
  34.         // The runtime type is assumed to be tType!
  35.  
  36.     static void WriteStaticObject(FW_CWritableArchive& writableArchive,
  37.                                   const tType* object);
  38.         // Write the construction information out to an archive.
  39.         // The archive's object registry is used.
  40.         // The runtime type is assumed to be tType!
  41.  
  42.  
  43.     // ----- Create specializations of these methods to archive objects by reference.
  44.  
  45.     static tType* DoReadObject(FW_CReadableArchive& readableArchive);
  46.         // The user must make a specialization of this function.
  47.  
  48.     static void DoWriteObject(FW_CWritableArchive& writableArchive,
  49.                               const tType* object);
  50.         // The user must make a specialization of this function.
  51. };
  52.  
  53.  
  54. //----------------------------------------------------------------------------------------
  55. //    FW_TStaticArchiver<tType>::ReadStaticObject
  56. //----------------------------------------------------------------------------------------
  57.  
  58. template <class tType>
  59. inline tType* FW_TStaticArchiver<tType>::ReadStaticObject(FW_CReadableArchive& readableArchive)
  60. {
  61.     return (tType *)readableArchive.InputObject((FW_CReadableArchive::InputFunction)DoReadObject);
  62. }
  63.  
  64. //----------------------------------------------------------------------------------------
  65. //    FW_TStaticArchiver<tType>::WriteStaticObject
  66. //----------------------------------------------------------------------------------------
  67.  
  68. template <class tType>
  69. inline void FW_TStaticArchiver<tType>::WriteStaticObject(FW_CWritableArchive& writableArchive,
  70.                                                          const tType* object)
  71. {
  72.     writableArchive.OutputObject((FW_CWritableArchive::OutputFunction)DoWriteObject, (const void*)object);
  73. }
  74.  
  75. #endif